var http = require("http");
var server = http.createServer();
server.on("request",function (request, response) {
    response.writeHead(200, {"content-type": "text/html"});
    response.write("<head><meta charset='UTF-8'></head>");
    // language=HTML
    response.write("<p>/*\n" +
        "    使用require函数加载模块时，若只指定了文件名而未指定路径时\n" +
        "    形如：require(\"yuyuanjs\");假设本文件目录为：/home/gia/yio/i/app.js\n" +
        "    因为nodejs将从node_modules目录中加载模块，则此时加载yuyuanjs模块时，\n" +
        "    加载路径依次为：(从本文件开始向上追溯node_moudles目录)\n" +
        "    /home/gia/yio/i/node_moudles/yuyuanjs.js\n" +
        "    /home/gia/yio/node_moudles/yuyuanjs.js\n" +
        "    /home/gia/node_moudles/yuyuanjs.js\n" +
        "    /home/node_moudles/yuyuanjs.js\n" +
        "    /node_moudles/yuyuanjs.js\n" +
        "*/\n" +
        "\n" +
        "/*\n" +
        "    比如要引用某些模块时，若不想指定模块名\n" +
        "    1.为该模块创建一个目录（目录名字与模块名字一致），并放在node_moudles目录下，此时将自动加载该模块\n" +
        "    2.更灵活方式（改进）：在该目录模块下，创建一个package.json文件，\n" +
        "    {\"name\": \"moudleName\", \"main\": \"./lib/moudleName.js\"}，此时将自动加载放在该目录下lib子目录的文件\n" +
        "*/\n" +
        "\n" +
        "\n</p>");
    response.end();
});
server.listen(3000);
console.log("server running at http://localhost:3000");

console.log(module.id);
